package edu.nf.takeoutdemo.mapper;

import com.github.pagehelper.Page;
import edu.nf.takeoutdemo.commons.annotation.AutoFill;
import edu.nf.takeoutdemo.commons.base.BaseMapper;
import edu.nf.takeoutdemo.commons.enumeration.OperationType;
import edu.nf.takeoutdemo.model.dto.DishPageQueryDTO;
import edu.nf.takeoutdemo.model.entity.Dish;
import edu.nf.takeoutdemo.model.vo.DishVO;

import java.util.List;
import java.util.Map;

/**
 *
 * @author zjl
 * @date 2025/10/25
 */
public interface DishMapper extends BaseMapper<Dish> {
    /**
     * 根据分类id查询菜品数量
     *
     * @param categoryId
     * @return
     */
    Integer countByCategoryId(Long categoryId);

    /**
     * 插入菜品数据
     * @param dish
     */
    @AutoFill(value= OperationType.INSERT)
    @Override
    void add(Dish dish);

    @AutoFill(value= OperationType.UPDATE)
    @Override
    void update(Dish dish);

    /**
     * 菜品分页查询
     * @param dishPageQueryDTO
     * @return
     */
    Page<DishVO> pageQuery(DishPageQueryDTO dishPageQueryDTO);

    /**
     * 根据菜品id集合批量删除菜品
     * @param ids
     */
    void deleteByIds(List<Long> ids);

    /**
     * 条件查询菜品数据
     * @param dish
     * @return
     */
    List<Dish> list(Dish dish);

    /**
     * 根据套餐id查询菜品
     * @param setmealId
     * @return
     */
    List<Dish> getBySetmealId(Long setmealId);

    /**
     * 根据条件统计菜品数量
     * @param map
     * @return
     */
    Integer countByMap(Map<String,Object> map);
}
